import { defineStore } from 'pinia'
import action from '../../api/action'
export const useActionMianStore = defineStore('actionMain', {
    state: () => ({
        loading: false,
        actionMainList: [

        ],
        pageNum: 1,
        pageSize: 6,
        total: 0
    }),
    actions: {
        // 获取列表
        async getAllList() {
            await action.getActionList().then(res => {
                this.actionMainList = res.data.data;
                this.total = res.data.total;
            }).catch(err => {
                console.log(err);
            });
        },
        //根据id获取活动
        getAction(id) {
            return this.actionMainList.find(item => item.id === id)
        }
    },
    getters: {

    },
}
)